package com.better.util.page;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Created by Administrator on 2017/11/20.
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Page {
    @ApiModelProperty(value = "第几页")
    private Integer pageIndex = 1;
    @ApiModelProperty(value = "每页多少记录")
    private Integer pageSize = 5;

    public Page(int pageIndex, int pageSize) {
        this.pageIndex = pageIndex;
        this.pageSize = pageSize;
    }

    public Integer getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;

        if (pageIndex < 1)
            this.pageIndex = 1;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
        if (pageSize < 1)
            this.pageSize = 5;
    }
}
